from building import *
import os
import sys

#默认不启用此组件
Enable_HBox_CPP=False

if  "Enable_HBox_CPP" in Env:
    Enable_HBox_CPP=True;

if  "Enable_HBox_CPP" in os.environ:
    Enable_HBox_CPP=True;

if not Enable_HBox_CPP:
    group = []
    Return('group')

#HBOX的LOCAL_CXXFLAGS,一般用于keil5设置c++11(--cpp11)
HBOX_LOCAL_CXXFLAGS = ''
if  "HBOX_LOCAL_CXXFLAGS" in os.environ:
    HBOX_LOCAL_CXXFLAGS = os.environ["HBOX_LOCAL_CXXFLAGS"]

cwd = GetCurrentDir()
src = Glob('*.c')
src += Glob('*.cpp')
CPPPATH = [
cwd
]

group = DefineGroup('HBox_CPP', src, depend = [''], CPPPATH = CPPPATH,LOCAL_CXXFLAGS=HBOX_LOCAL_CXXFLAGS)

list = os.listdir(cwd)
for item in list:
    if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
        group = group + SConscript(os.path.join(item, 'SConscript'))

Return('group')
